package fr.matwizz.mesdevoirs.android.task;

import android.os.AsyncTask;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import fr.matwizz.mesdevoirs.android.callback.TaskCallback;

/**
 * Created by RGA on 27/04/14.
 */
public abstract class AbstractTask<T> extends AsyncTask<String, Void, T> {

    protected TaskCallback<T> callback;

    public AbstractTask(TaskCallback<T> call) {
        this.callback = call;
    }

    private Gson gson;

    protected Gson getGson() {
        if (gson == null) {
            final GsonBuilder gsonBuilder = new GsonBuilder();
            gson = gsonBuilder.create();
        }
        return gson;
    }

}
